﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SampleWebsite.Domain;
using AccessKeyHighlighterControl;

namespace SampleWebsite
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            options.AccessKeyHighlighterInstance = akh;
            litAccessKeyShortcut.Text = Request.Browser.Browser == "IE" || Request.Browser.Browser.Contains("Safari") ? "Alt key" : "Shift+Alt keys";
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            Customer customer = HarvestCustomerFromForm();
            // Save the customer
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {

        }

        private Customer HarvestCustomerFromForm()
        {
            return new Customer()
            {
                Id = Convert.ToInt32(hidCustomerId.Value),
                FirstName = txtFirstName.Text,
                LastName = txtLastName.Text,
                DateOfBirth = calDOB.SelectedDate,
                WorkPhone = txtWorkPhone.Text,
                HomePhone = txtHomePhone.Text,
                MobilePhone = txtMobilePhone.Text,
                Email = txtEmail.Text,
                HomeAddressStreet1 = txtHomeStreet1.Text,
                HomeAddressStreet2 = txtHomeStreet2.Text,
                HomeAddressCity = txtHomeCity.Text,
                HomeAddressState = ddlHomeState.SelectedValue,
                HomeAddressPostCode = txtHomePostCode.Text
            };
        }
    }
}
